﻿<ol class="breadcrumb">
    <li><a ui-sref="apps.list">应用列表</a></li>
    <li><a>编辑</a></li>
</ol>

<form ng-submit="save()" class="app">
    <div class="text-danger">
        {{error_message}}
    </div>
    <div class="form-group">
        <label for="inputAppName">应用名称 </label>
        <input type="text" class="form-control" id="inputAppName" placeholder="应用名称 (必填)" maxlength="50"
               ng-model="app.name">
    </div>
    <div class="form-group">
        <label for="inputAppId">应用Id </label>
        <input type="text" class="form-control" id="inputAppId" placeholder="应用Id（必填）" maxlength="36"
               ng-model="app.id" ng-disabled="true">
    </div>
    <div class="form-group">
        <label for="inputSecret">密钥</label>
        <input type="text" class="form-control" id="inputSecret" placeholder="密钥" maxlength="36"
               ng-model="app.secret">
    </div>
    <div class="form-group">
        <label>
            可被继承
        </label>
        <input type="checkbox" class="form-control" ng-model="app.inheritanced">
    </div>
    <div class="form-group">
        <label>
            启用
        </label>
        <input type="checkbox" class="form-control" ng-model="app.enabled">
    </div>
    <div class="form-group">
        <label>
            继承应用
        </label>
        <div class="ref-apps">
            <div class="ref-app" ng-repeat="app in app.inheritancedApps">
                {{app.name}}
                <span class="glyphicon glyphicon-remove-circle" title="remove" aria-hidden="true" ng-click="removeSelectedRefApp($index)"></span>
            </div>
            <span class="glyphicon glyphicon-plus" title="add" aria-hidden="true" ng-click="showChooseRefAppsModal()"></span>
        </div>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="modal_add_refapp" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">请选择需要继承的应用</h4>
                </div>
                <div class="modal-body">
                    <div class="ref-apps">
                        <div class="ref-app" ng-class="app.selected?'selected':''" ng-click="chooseRefApp(app)" ng-repeat="app in inheritancedApps|filter:{ refed:0 }">
                            {{app.name}}
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" ng-click="AddSelectedRefApps()">确定</button>
                </div>
            </div>
        </div>
    </div>
    <button type="submit" class="btn btn-primary">确定</button>
    <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
</form>
